package com.putable.nmc.dmv;

import com.putable.pqueue.PQueue;



public class Door extends PQElement {
	
	public Door(){
		setState(DoorState.INITIAL);
	}
	/**
	 * Main constructor for Door
	 * @param pq The Priority Queue
	 */
	public Door(PQueue pq){
		super(pq);
		setState(DoorState.INITIAL);
	}
	
	/**
	 * Just add the customer to the PQueue. The customer will admit themselves after this
	 * @param time The current time
	 * @param c The customer entering the store
	 */
	public void addCustToPQ(double time, Customer c){
		if(getState() == DoorState.INITIAL){
			setState(DoorState.OPEN);
		}
		if(getState() == DoorState.OPEN){
			c.setTimeOfNextTask(time + c.getCit().getArrivalTime());
			getPQueue().insert(c);
		}
	}
	
	@Override
	public void run(double time, CustomerLine cLine) {
		
	}
	
	

}
